#!/usr/bin/env python
# -*- coding: utf-8 -*-
from tkinter import filedialog

import xlwings as xw
import tkinter as tk


def read_data_from_excel():
    app = xw.apps.active
    wb = app.books.active
    sheet = wb.sheets.active
    cell_value = sheet.range('A1').value
    sheet.range('A2').value = 'hello'
    print(f"A1:{cell_value}")

def test():
    wb = xw.books['单据自动化系统.xlsm']
    sheet = wb.sheets['主程序填单']
    cell_value = sheet.range('A1').value
    print(f"A1:{cell_value}")

def get_user_input():
    root = tk.Tk()
    root.withdraw()  # 隐藏主窗口
    file_path = filedialog.askopenfilename(
        filetypes=[("Excel files", "*.xlsx *.xls")])  # 打开文件选择对话框，只允许选择 Excel 文件
    # check_if_exists = simpledialog.askstring("输入","每次填单前,是否检查该单号已经存在？(Y/N)：").strip() or "N"
    # check_total = simpledialog.askstring("输入","填单结束后,是否总单数检查？(Y/N)：").strip() or "N"
    return file_path
if __name__ == "__main__":
    print(11)
    get_user_input()

